package com.atguigu.springcloud.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 孙志鹏
 * @createDate 2022/5/7 12:13
 */
@RestController
public class HotspotKeyController {

    /**
     * 测试热点Key
     * @param id
     * @param name
     * @return
     */
    @GetMapping("/hotsKey/{id}/{name}")
    @SentinelResource(value = "testHotsKey",blockHandler = "dealHandler_testHotsKey")
    public String hotsKey(@PathVariable String id,
                          @PathVariable String name) {
        return "------hotsKey";
    }

    public String dealHandler_testHotsKey(String id, String name, BlockException blockException) {
        return "------dealHander_testHotsKey 555~";
    }
}
